<div class="menu">
  <a href="/notes/create" class="nes-btn is-primary">
    <i class="nes-icon coin is-small"></i> New Note</a>
  <% if (isLogin !== true) { %>
  <a href="/users/register" class="nes-btn is-warning">
    <i class="nes-icon like is-small"></i> Register</a>
  <a href="/users/login" class="nes-btn is-warning">
    <i class="nes-icon like is-small"></i> Login</a>
<% } else { %>
  <a href="/users/logout" class="nes-btn is-error">
    <i class="nes-icon close is-small"></i> Logout</a>
<% } %>
</div>
<% if (flash) { %>
  <div class="nes-container is-rounded">
    <p class="nes-text is-success"><%= flash.text %></p>
  </div>
<% } %>
<div class="notes">
  <% if ( notes && notes.length > 0 ) { %>
    <% notes.forEach(function (note) { %>
      <div class="note">
        <div class="nes-container is-dark">
          <h2><a href="/notes/<%= note.id %>/edit"><%= note.title %></a></h2>
          <p><%= note.body %></p>
          <span class="nes-text is-disabled date"><%= noteAge(note.created_at) %></span>
          <div class="buttons">
            <a class="nes-btn is-warning" href="/notes/<%= note.id%>/edit">
              <i class="nes-icon heart is-small"></i> Edit
            </a> 
            <form method="post" action="/notes/<%= note.id %>/remove?_method=DELETE">
              <button class="remove nes-btn is-error" name="remove" onclick="return confirm('Are you sure?');">
              <i class="nes-icon close is-small"></i> Delete
            </button>
            </form>
          </div>
        </div>
      </div>
    <% }) %>
  <% } else { %>
    <div>No notes yet...<a href="#" class="nes-btn is-primary">Create one here</a></div>
  <% } %>
</div>
